package com.example.travel.fragment;

import android.os.Bundle;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.fragment.app.Fragment;

import com.example.travel.R;


public class ReacherContactFragment extends Fragment {


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
    EditText etSearchUserName;
    Button btSearch;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view=inflater.inflate(R.layout.search_contact, container, false);
        etSearchUserName=(EditText) view.findViewById(R.id.et_searchUserName);
        btSearch=(Button)view.findViewById(R.id.bt_search);
        btSearch.setOnClickListener(new View.OnClickListener(){

            @Override
            public void onClick(View v) {
                String name=etSearchUserName.getText().toString().trim();
                if(name==null||name.equals("")){
                    Toast.makeText(getContext(),"请输入要查找商品名称!",Toast.LENGTH_SHORT)
                            .show();
                }else{
                    Fragment searchContactListFragment=new SearchContactListFragment();
                    Bundle bundle=new Bundle();
                    bundle.putString("searchName",name);
                    searchContactListFragment.setArguments(bundle);
                    getFragmentManager().beginTransaction().replace(R.id.flconent,searchContactListFragment)
                            .commit();
                }
            }
        });
        return view;
    }

}
